Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
solidity-parser-antlr
Advanced tools
A Solidity parser built on top of a robust ANTLR4 grammar.
import parser from 'solidity-parser-antlr';
var input = `
contract test {
uint256 a;
function f() {}
}
`
try {
parser.parse(input)
} catch (e) {
if (e instanceof parser.ParserError) {
console.log(e.errors)
}
}
The parse
method also accepts a second argument which lets you specify the
following options, in a style similar to the esprima API:
Key | Type | Default | Description |
---|---|---|---|
tolerant | Boolean | false | When set to true it will collect syntax errors and place them in a list under the key errors inside the root node of the returned AST. Otherwise, it will raise a parser.ParserError . |
loc | Boolean | false | When set to true , it will add location information to each node, with start and stop keys that contain the corresponding line and column numbers. Column numbers start from 0, lines start from 1. |
range | Boolean | false | When set to true , it will add range information to each node, which consists of a two-element array with start and stop character indexes in the input. |
parser.parse('contract test { uint a; }', { loc: true })
// { type: 'SourceUnit',
// children:
// [ { type: 'ContractDefinition',
// name: 'test',
// baseContracts: [],
// subNodes: [Array],
// kind: 'contract',
// loc: [Object] } ],
// loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 24 } } }
var ast = parser.parse('contract test { uint a; }')
// output the path of each import found
parser.visit(ast, {
ImportDirective: function(node) {
console.log(node.path)
}
})
Federico Bond (@federicobond)
MIT
0.4.11
FAQs
A Solidity parser built from a robust ANTLR 4 grammar
The npm package solidity-parser-antlr receives a total of 3,337 weekly downloads. As such, solidity-parser-antlr popularity was classified as popular.
We found that solidity-parser-antlr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.